<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../js/boot.js"></script>
</head>

<body>
    <div id="container">
        <div id="formcontainer">
            <form class="layui-form layui-form-pane" id="editform" lay-filter="editform">
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item">
                            <label class="layui-form-label">所属目录</label>
                            <div class="layui-input-block">
                                <input type="text" name="group_id" id="group_id" autocomplete="off" class="layui-input" value="0" lay-filter="group_id">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item">
                            <label class="layui-form-label required">字典名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="code_name" autocomplete="off" class="layui-input required">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">说明</label>
                            <div class="layui-input-block">
                                <textarea type="text" name="remark" autocomplete="off" class="layui-textarea"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label required">系统内置</label>
                            <div class="layui-input-block">
                                <input type="text" name="system_init" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs6">
                        <div class="layui-form-item">
                            <label class="layui-form-label">排序</label>
                            <div class="layui-input-block">
                                <input type="text" name="sort_num" autocomplete="off" class="layui-input number" value="0">
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div id="opcontainer">
            <button class="layui-btn" onclick="HandleSave()">确认</button>
            <button class="layui-btn layui-btn-primary" onclick="HandleClose()">关闭</button>
        </div>
    </div>
</body>
<script>
    var FormDetail = null;

    $(function() {
        BindRadio("system_init", "是否", 20);
        LoadDetail();
    })

    function LoadDetail() {
        var param = {
            row_id: GetUrlParam("row_id")
        }
        SetForm("editform", "system/setting/codemain/detail", param, function(data) {
            FormDetail = data;
            BindSelectTree("group_id", "system/setting/group/tree", { groupTag: "DataDic" }, FormDetail.group_id)
        })
    }

    function HandleSave() {
        SubmitForm('editform', 'system/setting/codemain/update', BeforeSubmit, FormDetail, function(result, status) {
            if (result.code == 0) {
                OpenSuccess('保存成功', function(params) {
                    CloseDialog();
                })

            } else {
                OpenFail(result.msg);
            }
        })
    }

    function BeforeSubmit(data) {
        return true;
    }


    function HandleClose() {
        CloseDialog();
    }
</script>

</html>